import Vue from "vue";
import Router from "vue-router";

Vue.use(Router);

// 页面
import notFound from "src/pages/404/404";
import topic from "src/pages/topic/topic";
import shuoshuo from "src/pages/shuohsuo/shuoshuo";
import replace from "../pages/replace/replace.vue";
import publishreplace from "../pages/replace/publicereplace/publishreplace.vue";
import publishshuoshuo from "../pages/shuohsuo/publishshuoshuo/publishuoshuo.vue";
import topicdetail from "../pages/topic/topicdetail/topicdetail.vue";
import publishcomments from "../pages/topic/topicdetail/publishcomment/publishcomments.vue";
import commentsdetail from "../pages/topic/topicdetail/commentsdetail/commentsdetail.vue";
import search from "../pages/search/search.vue";
import newenrollment from "../pages/topic/topicdetail/activebaoming/activeapply.vue";

import searchResult from "../pages/search/search-result";
import ylMessage from "src/pages/message/yl-message";

import shuodetail from "../pages/shuohsuo/shuoshuodetail/shuoshuodetail.vue";
import replacedetail from "../pages/replace/replacedetail/replacedetail.vue";
import publishbigsay from "../pages/shuohsuo/publishbigsay/publishbigsay.vue";

import message from "pages/message/message";
import mine from "pages/mine/mine";
import myPublish from "pages/mine/myPublish";
import myParticipate from "pages/mine/myParticipate";
import publishreplacecomments from "../pages/replace/replacedetail/publishrepcomments/publishrepcomments.vue";
import chatlog from "../pages/mine/chatlog.vue";
import activityrecommendation from "../pages/mine/activityrecommendation/activityrecommendation.vue";
import activityrecommendationdetail from "../pages/mine/activityrecommendation/activityrecommendationdetail.vue";
import roundrotate from "../pages/rotate/roundrotate.vue";
import squarerotate from "../pages/rotate/squarerotate.vue";
import slotrotate from "../pages/rotate/slotrotate.vue";
import address from "../pages/rotate/address.vue";
import submitresult from "../pages/rotate/submitresult.vue";
import discovery from "../pages/discovery/discovery.vue";
import findDiscovery from "../pages/discovery/findDiscovery.vue";
import discoveryClub from "../pages/discovery/discoveryClub.vue";
import disdetail from "../pages/discovery/disdetail/disdetail.vue";
import publishdis from "../pages/discovery/publishdis/publishdis.vue";

import collection from "../pages/collection/collection.vue";
import activityrule from "../pages/topic/topicdetail/activityrule/activityrule.vue";
import paper from "../pages/topic/topicdetail/paper/paper.vue";
import usehelp from "../pages/mine/usehelp/usehelp.vue";
import pointsmall from "../pages/pointsmall/pointsmall.vue";
import pointsdetail from "../pages/pointsmall/pointsdetail.vue";
import pointsrule from "../pages/pointsmall/pointsrule.vue";
import goodsdetail from "../pages/pointsmall/goodsdetail.vue";
import checkin from "../pages/pointsmall/checkin.vue";
import exchangerecode from "../pages/pointsmall/exchangerecode.vue";
import addressinfo from "../pages/rotate/addressinfo.vue";
import cellphone from "../pages/pointsmall/cellphone.vue";
import shipaddress from "../pages/pointsmall/shipaddress.vue";
import writephone from "../pages/pointsmall/writephone.vue";
import showaddress from "../pages/pointsmall/showaddress.vue";
import sysmsg from "../pages/message/sysmsg.vue";
import tryoutgoodslist from "../pages/tryout/tryoutgoodslist.vue";
import tryoutdetail from "../pages/tryout/tryoutdetail.vue";
import trialreport from "../pages/tryout/trialreport.vue";
import publishreport from "../pages/tryout/publishreport.vue";
import myreport from "../pages/tryout/myreport.vue";
import personalinfor from "../pages/mine/personalinfor/personalinfor.vue";
import submission from "../pages/topic/submission.vue";
import mysubmission from "../pages/mine/submission/mysubmission.vue";
import statistics from "../pages/statistics/statistics.vue";

// 试吃试用
import tryoutList from "../pages/tryout/tryoutList.vue";
import tryoutDetails from "../pages/tryout/tryoutDetails.vue";
import tryoutNow from "../pages/tryout/tryoutNow.vue";
// 圈子详情页
import discoveryDetails from "../pages/discovery/discoveryDetails.vue";
/**
 * auth true 用户登录才能访问，false不需要登录，默认true
 */
export default new Router({
  //mode: "history",
  scrollBehavior(to, from, savedPosition) {
    // 保存到 meta 中，备用
    to.meta.savedPosition = savedPosition;
    if (savedPosition) {
      return { x: 0, y: 0 };
    }
    return {};
  },
  routes: [
    {
      path: "/", // 首页
      name: "/",
      meta: {
        auth: false,
        // keepAlive:true,
      },
      component: (resolve) => require(["../pages/index/index"], resolve),
    },
    {
      path: "/404", // 404
      name: "404",
      meta: {
        auth: false,
      },
      component: notFound,
    },

    {
      path: "/topic",
      name: "topic",
      meta: {
        auth: false,
      },
      component: topic,
    },
    {
      path: "/shuoshuo",
      name: "shuoshuo",
      meta: {
        auth: false,
      },
      component: shuoshuo,
    },
    {
      path: "/replace",
      name: "replace",
      meta: {
        auth: false,
      },
      component: replace,
    },
    {
      path: "/publishreplace",
      name: "publishreplace",
      meta: {
        auth: false,
      },
      component: publishreplace,
    },
    {
      path: "/publishshuoshuo",
      name: "publishshuoshuo",
      meta: {
        auth: false,
      },
      component: publishshuoshuo,
    },
    {
      path: "/topicdetail",
      name: "topicdetail",
      meta: {
        auth: false,
      },
      component: topicdetail,
    },
    {
      path: "/publishcomments",
      name: "publishcomments",
      meta: {
        auth: false,
      },
      component: publishcomments,
    },
    {
      path: "/commentsdetail",
      name: "commentsdetail",
      meta: {
        auth: false,
      },
      component: commentsdetail,
    },
    {
      path: "/search",
      name: "search",
      component: search,
    },
    {
      path: "/newenrollment",
      name: "newenrollment",
      meta: {
        auth: false,
      },
      component: newenrollment,
    },
    {
      path: "/searchResult",
      name: "searchResult",
      component: searchResult,
    },
    {
      path: "/ylMessage",
      name: "ylMessage",
      component: ylMessage,
    },
    {
      path: "/shuodetail",
      name: "shuodetail",
      meta: {
        auth: false,
      },
      component: shuodetail,
    },
    {
      path: "/disdetail",
      name: "disdetail",
      meta: {
        auth: false,
      },
      component: disdetail,
    },
    {
      path: "/replacedetail",
      name: "replacedetail",
      meta: {
        auth: false,
      },
      component: replacedetail,
    },
    {
      path: "/publishbigsay",
      name: "publishbigsay",
      meta: {
        auth: false,
      },
      component: publishbigsay,
    },
    {
      path: "/publishdis",
      name: "publishdis",
      meta: {
        auth: false,
      },
      component: publishdis,
    },
    {
      path: "/message",
      name: "message",
      component: message,
    },
    {
      path: "/publishreplacecomments",
      name: "publishreplacecomments",
      meta: {
        auth: false,
      },
      component: publishreplacecomments,
    },
    {
      path: "/chatlog",
      name: "chatlog",
      meta: {
        auth: false,
      },
      component: chatlog,
    },
    {
      path: "/activityrecommendation",
      name: "activityrecommendation",
      meta: {
        auth: false,
      },
      component: activityrecommendation,
    },
    {
      path: "/activityrecommendationdetail",
      name: "activityrecommendationdetail",
      meta: {
        auth: false,
      },
      component: activityrecommendationdetail,
    },
    {
      path: "/roundrotate",
      name: "roundrotate",
      meta: {
        auth: false,
      },
      component: roundrotate,
    },
    {
      path: "/squarerotate",
      name: "squarerotate",
      meta: {
        auth: false,
      },
      component: squarerotate,
    },
    {
      path: "/slotrotate",
      name: "slotrotate",
      meta: {
        auth: false,
      },
      component: slotrotate,
    },
    {
      path: "/address",
      name: "address",
      meta: {
        auth: false,
      },
      component: address,
    },
    {
      path: "/submitresult",
      name: "submitresult",
      meta: {
        auth: false,
      },
      component: submitresult,
    },
    {
      path: "/findDiscovery",
      name: "findDiscovery",
      meta: {
        auth: false,
      },
      component: findDiscovery,
    },
    {
      path: "/discovery",
      name: "discovery",
      meta: {
        auth: false,
      },
      component: discovery,
    },
    {
      path: "/discoveryClub",
      name: "discoveryClub",
      meta: {
        auth: false,
      },
      component: discoveryClub,
    },
    {
      path: "/mine",
      name: "mine",
      meta: {
        auth: false,
      },
      component: mine,
    },
    {
      path: "/myPublish",
      name: "myPublish",
      meta: {
        auth: false,
      },
      component: myPublish,
    },
    {
      path: "/myParticipate",
      name: "myParticipate",
      meta: {
        auth: false,
      },
      component: myParticipate,
    },
    {
      path: "/collection",
      name: "collection",
      meta: {
        auth: false,
      },
      component: collection,
    },
    {
      path: "/activityrule",
      name: "activityrule",
      meta: {
        auth: false,
      },
      component: activityrule,
    },
    {
      path: "/usehelp",
      name: "usehelp",
      meta: {
        auth: false,
      },
      component: usehelp,
    },
    {
      path: "/pointsmall",
      name: "pointsmall",
      meta: {
        auth: false,
      },
      component: pointsmall,
    },
    {
      path: "/pointsdetail",
      name: "pointsdetail",
      meta: {
        auth: false,
      },
      component: pointsdetail,
    },
    {
      path: "/pointsrule",
      name: "pointsrule",
      meta: {
        auth: false,
      },
      component: pointsrule,
    },
    {
      path: "/exchangerecode",
      name: "exchangerecode",
      meta: {
        auth: false,
      },
      component: exchangerecode,
    },
    {
      path: "/goodsdetail",
      name: "goodsdetail",
      meta: {
        auth: false,
      },
      component: goodsdetail,
    },
    {
      path: "/checkin",
      name: "checkin",
      meta: {
        auth: false,
      },
      component: checkin,
    },
    {
      path: "/addressinfo",
      name: "addressinfo",
      meta: {
        auth: false,
      },
      component: addressinfo,
    },
    {
      path: "/cellphone",
      name: "cellphone",
      meta: {
        auth: false,
      },
      component: cellphone,
    },
    {
      path: "/shipaddress",
      name: "shipaddress",
      meta: {
        auth: false,
      },
      component: shipaddress,
    },
    {
      path: "/writephone",
      name: "writephone",
      meta: {
        auth: false,
      },
      component: writephone,
    },
    {
      path: "/showaddress",
      name: "showaddress",
      meta: {
        auth: false,
      },
      component: showaddress,
    },
    {
      path: "/sysmsg",
      name: "sysmsg",
      meta: {
        auth: false,
      },
      component: sysmsg,
    },
    {
      path: "/tryoutgoodslist",
      name: "tryoutgoodslist",
      meta: {
        auth: false,
      },
      component: tryoutgoodslist,
    },
    {
      path: "/tryoutdetail",
      name: "tryoutdetail",
      meta: {
        auth: false,
      },
      component: tryoutdetail,
    },
    {
      path: "/trialreport",
      name: "trialreport",
      meta: {
        auth: false,
      },
      component: trialreport,
    },
    {
      path: "/publishreport",
      name: "publishreport",
      meta: {
        auth: false,
      },
      component: publishreport,
    },
    {
      path: "/myreport",
      name: "myreport",
      meta: {
        auth: false,
      },
      component: myreport,
    },
    {
      path: "/personalinfor",
      name: "personalinfor",
      meta: {
        auth: false,
      },
      component: personalinfor,
    },
    {
      path: "/paper",
      name: "paper",
      meta: {
        auth: false,
      },
      component: paper,
    },
    {
      path: "/submission",
      name: "submission",
      meta: {
        auth: false,
      },
      component: submission,
    },
    {
      path: "/mysubmission",
      name: "mysubmission",
      meta: {
        auth: false,
      },
      component: mysubmission,
    },
    {
      path: "/statistics",
      name: "statistics",
      meta: {
        auth: false,
      },
      component: statistics,
    },

    // 试吃试用
    {
      path: "/tryoutList",
      name: "tryoutList",
      meta: {
        auth: false,
      },
      component: tryoutList,
    },
    {
      path: "/tryoutDetails",
      name: "tryoutDetails",
      meta: {
        auth: false,
      },
      component: tryoutDetails,
    },
    {
      path: "/tryoutNow",
      name: "tryoutNow",
      meta: {
        auth: false,
      },
      component: tryoutNow,
    },
    {
      path: "/discoveryDetails",
      name: "discoveryDetails",
      meta: {
        auth: false,
      },
      component: discoveryDetails,
    },
  ],
});
